<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src='ajax.js'></script>
<script>
	window.onload=function()
	{
		var oBtn = document.getElementById('btn1');
		var oUl = document.getElementById('ul1');

		
		oBtn.onclick=function()
		{
			ajax('user.txt?t='+ new Date().getTime(),function(str){
				var arr = eval(str);
				//alert(arr[0].user);  //array
				for(var i = 0 ;i<arr.length;i++)
					{
						var oLi = document.createElement('li');
						oLi.innerHTML='用户名：'+ arr[i].user +  ' 密码：' + arr[i].password;
						oUl.appendChild(oLi);
					}
			},function(){
				alert('fail');
			});
		}
	}
</script>

</head>

<body>
	<input type="button" id ='btn1' value = '读取'>
	<ul id="ul1">
		
	</ul>
</body>
</html>


